<?php

namespace app\controller\index;

use app\result\CodeResult;
use app\result\UserResult;

class Code extends BaseIndex
{
    protected $unauthorized = ['reg', 'login', 'find_pwd'];

    //邮箱验证码
    public function send_code($email)
    {
        data_exit_json((new CodeResult())->send_code($email, 0));
    }

    //发送验证码
    public function reg($phone)
    {
        data_exit_json((new CodeResult())->send_code($phone, 1));
    }

    //登录验证码
    public function login($phone)
    {
        data_exit_json((new CodeResult())->send_code($phone, 2));
    }

    //找回密码验证码
    public function find_pwd()
    {
        data_exit_json((new UserResult())->forget_code($this->param));
    }
}
